package com.slz3.business.module.memberManagement.drawTicket.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.memberManagement.drawTicket.domain.DrawTicket;
import com.slz3.business.module.memberManagement.drawTicket.domain.DrawTicketCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

public class DrawTicketResController extends DrawTicketResAtomic {

    public Mono<ServerResponse> add(ServerRequest req, DrawTicket drawTicket) {
        if (DrawTicketResUnsafeValid.add(req, drawTicket)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.add_$DrawTicketUpdateLock(req, drawTicket);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, DrawTicketCondition drawTicketCondition) {
        if (DrawTicketResUnsafeValid.delete(req, drawTicketCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.delete_$DrawTicketUpdateLock(req, drawTicketCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, DrawTicket drawTicket) {
        if (DrawTicketResUnsafeValid.modify(req, drawTicket)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.modify_$DrawTicketUpdateLock(req, drawTicket);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (DrawTicketResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return drawTicketResAtomic.info_$DrawTicketUpdateLock(req);
        if (DrawTicketResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.info_$DrawTicketUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (DrawTicketResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, DrawTicketCondition drawTicketCondition) {
        //
        if (DrawTicketResUnsafeValid.auditSubmit(req, drawTicketCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.auditSubmit_$DrawTicketUpdateLock(req, drawTicketCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, DrawTicketCondition drawTicketCondition) {
        if (DrawTicketResUnsafeValid.audit(req, drawTicketCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.audit_$DrawTicketUpdateLock(req, drawTicketCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, DrawTicketCondition drawTicketCondition) {
        if (DrawTicketResUnsafeValid.auditReject(req, drawTicketCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.auditReject_$DrawTicketUpdateLock(req, drawTicketCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, DrawTicketCondition drawTicketCondition) {
        if (DrawTicketResUnsafeValid.usingEnable(req, drawTicketCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.usingEnable_$DrawTicketUpdateLock(req, drawTicketCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, DrawTicketCondition drawTicketCondition) {
        if (DrawTicketResUnsafeValid.usingDisable(req, drawTicketCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return super.usingDisable_$DrawTicketUpdateLock(req, drawTicketCondition);
        }
    }

}
